package com.boot2.core.web.websocket;

import org.springframework.http.server.ServerHttpRequest;
import org.springframework.http.server.ServerHttpResponse;
import org.springframework.web.socket.WebSocketHandler;

import java.security.Principal;
import java.util.Map;

/**
 * @author zhangweilin
 * @Description: websocket登陆身份校验
 * @date 2019/9/24
 */
public abstract class AbstractWebsocketPrincipal {

//    /**
//     * 通过token获取登陆用户信息，然后构建Principal
//     * @param token
//     * @return
//     */
//    public abstract Principal getByToken(String token) ;

    /**
     * 通过token获取登陆用户信息，然后构建Principal
     * @param token
     * @return
     */
    public abstract Principal getPrincipal(ServerHttpRequest request, ServerHttpResponse response, WebSocketHandler wsHandler, Map<String, Object> attributes) ;
}
